
namespace NetDns
{
	/// <summary>
	/// A CNAME Resource Record (RR) (RFC1035 3.3.11)
	/// </summary>
	public class Cname : IResourceRecord
	{
        public int RecordType { get { return 5; } }
        public IResourceRecord Parse(Pointer pointer, int length)
        {
            return new Cname(pointer);
        }


		// the fields exposed outside the assembly
		private readonly string		hostname;

		// expose this domain name address r/o to the world
		public string Hostname	{ get { return hostname; }}
				
		/// <summary>
		/// Constructs a NS record by reading bytes from a return message
		/// </summary>
		/// <param name="pointer">A logical pointer to the bytes holding the record</param>
		internal Cname(Pointer pointer)
		{
			hostname = pointer.ReadDomain();
		}

		public override string ToString()
		{
			return hostname;
		}
	}
}